package yo.latyoo.hokage.skmr.biz.service;

import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import yo.latyoo.hokage.skmr.biz.domain.JobInfo;
import yo.latyoo.hokage.skmr.biz.repository.JobInfoRepo;
import yo.latyoo.hokage.tools.exception.HokageException;

@Service
public class JobInfoService {

    @Resource
    private JobInfoRepo repo;
/*
    public JobInfo patch(Long id, JobInfoReqParam param){
        JobInfo jobInfo = repo.findById(id)
                .orElseThrow(() -> new HokageException("not exists!"));
        if(param.getJobStatus() != null ){
            if(param.getJobStatus().intValue() == jobInfo.getJobStatus())
                throw new HokageException("job status error");
            else
                jobInfo.setJobStatus(param.getJobStatus());
        }
        if(StringUtil.isNotNull(param.getExpression()))
            jobInfo.setExpression(param.getExpression());
        return repo.save(jobInfo);
    }*/

    public JobInfo get(Long id){
        return repo.findById(id).orElseThrow(() -> new HokageException("not exists!"));
    }
}
